package com.wwp.tbshop.dagger2;


import com.wwp.tbshop.activity.orderlist.OrderDetailActivity;
import com.wwp.tbshop.presenter.OrderDetailOperation;

import dagger.Module;
import dagger.Provides;

/**
 * Created by user on 2017/6/8.
 *
 * dagger2 四个注解的使用
 * @module @Providers @Component @Inject
 *
 * @Module: 标注对象创建的容器
 * @Provider: 标识需要创建的对象
 * @Component: 将创建好的对象与需要注入的对象组合到一起
 * @Inject: 需要注入的对象
 *
 * @Module
 * pubic class MainActivityModule{
 *     MainActivity mMainActivity;
 *     public MainActivityModule(MainActivity mainActivity){
 *         mMainActivity = mainActivity;
 *     }
 * }
 *
 * @Providers
 * MainActivityPresenter proverderMainActivityPresenter(){
 *     return new_goods MainActivityPresenter(mMainActivity);
 * }
 *
 * @Component(modules = MainActivityModule.class)
 * public interface OrderListActivityComponent{
 *     void in(MainActivity mainActivity);
 * }
 *
 * @Inject
 * MainActivityPresenter mMainActivityPresenter;
 *
 * DaggerMainActivityComponent.builder().mainActivityModule(new_goods MainActivityModule(this).build().in(this));
 *
 *
 *
 *
 * @Module
 * public class MainActivityModule{
 *     MainActivity mMainActivity;
 *     public MainActivityModule(MainActivity mainActivity){
 *         mMainACtivity = mainActivity;
 *     }
 * }
 *
 * @Providers
 * MainActivityPresenter providerMainActivityPresenter(){
 *     return new_goods MainActivityPresenter(mMainACtivity);
 * }
 *
 * @Component(modules = MainActivityModule.class)
 *     public interface OrderListActivityComponent{
 *         void in(MainACtivity mainActivity);
 *     }
 *
 *
 * @Inject
 * MainActivityPresenter mMainActivityPresenter;
 *
 * DaggerMainActivityComponent.builder().mainActivityModule(new_goods MainACtivityModule(this)).build().in(this);
 */

/**
 * 这个类的本质还是创建了一个MainActivityPresenter
 */
@Module
public class OrderDetailAvtivityModule {
    private OrderDetailActivity mOrderDetailActivity;


    public OrderDetailAvtivityModule(OrderDetailActivity orderDetailActivity) {
        mOrderDetailActivity = orderDetailActivity;
    }

    @Provides
    public OrderDetailOperation providerOrderDetailOperation(){
        return new OrderDetailOperation(mOrderDetailActivity);
    }
}
